﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace APICommond
{
    public class DateString
    {
        public static DataTable Dateformat(DataTable dt)
        {
            foreach (DataColumn col in dt.Columns)
            {
                if (col.ColumnName.Contains("rq"))
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        string s = Convert.ToString(row[col]).Trim();
                        if (s != "" && s.Length>=8)
                        {
                            row[col] = s.Substring(0, 4) + "-" + s.Substring(4, 2) + "-" + s.Substring(6,2);
                        }
                    }
                }
            }
            return dt;
        }
    }
}
